using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Konst3d.Efficiency;

namespace Efficiency.Controls
{
	/// <summary>
	/// Converts DateTime value passed to age\duration string - "X years Y months Z days"
	/// </summary>
	public class DurationConverter : IValueConverter
	{
		#region IValueConverter Members

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			var date = DateTime.Now.Date;

			if (value != null)
			{
				date = (DateTime)value;
			}

			return date.GetAge();
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			throw new NotImplementedException();
		}

		#endregion
	}
}
